package com.cubesugar2014.withchild;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;

public class SBroadReceiver extends BroadcastReceiver {
	 
	public static final String PREFS_NAME = "WChildPrefsFile";

    @Override
    public void onReceive(Context context, Intent intent) {
    	
    	   Log.i("BOOTSVC", "Intent received");    
    	     
    	   SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);
    	   Boolean startup = settings.getBoolean("startup", true);
    	   
    	        
    	if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction()))
    			if (startup == true)
    			{
    				context.startService(new Intent("com.cubesugar2014.withchild.service"));  
    	
    			}
    	
    }
}